package com.bwie.controller;

import com.bwie.pojo.GroupActive;
import com.bwie.pojo.GroupJoin;
import com.bwie.pojo.Order;
import com.bwie.service.GroupActiveService;
import com.bwie.service.GroupJoinService;
import com.bwie.service.GroupService;
import com.bwie.utils.R;
import com.bwie.vo.ActiveVo;
import com.bwie.vo.GroupVo;
import com.bwie.vo.JoinVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: tsh
 * @Date: 2025/7/27 19:05
 * @Description: TODO
 **/
@RestController
@RequestMapping("/team/index")
@Api(tags = "拼团管理")
public class IndexController {
    @Autowired
    GroupActiveService activeService;
    @Autowired
    GroupJoinService groupJoinService;
    @Autowired
    GroupService groupService;
    @PostMapping("/getActiveList")
    @ApiOperation(value = "分页获取活动列表")
    public R getActiveList(@RequestBody ActiveVo activeVo){
        return activeService.getActiveList(activeVo);

    }
    @PostMapping("/addActive")
    @ApiOperation(value = "活动添加")
    public R addActive(@RequestBody GroupActive groupActive){
        return activeService.addActive(groupActive);
    }
    @PostMapping("/updateActive")
    @ApiOperation(value = "修改活动")
    public R updateActive(@RequestBody GroupActive groupActive){
        return activeService.updateActive(groupActive);
    }
    @PostMapping("/deleteAllActive")
    @ApiOperation(value = "批量删除活动")
    public R deleteAllActive(@RequestBody List<GroupActive> activeList){
        return activeService.deleteAllActive(activeList);
    }
    @PostMapping("/deleteActive")
    @ApiOperation(value = "删除活动")
    public R deleteActive(@RequestBody GroupActive groupActive){
        return activeService.deleteActive(groupActive);
    }

    @PostMapping("/getGroupJoinList")
    @ApiOperation(value = "商家活动列表")
    public R getGroupJoinList(@RequestBody JoinVo joinVo){
        return groupJoinService.getGroupJoinList(joinVo);
    }
    @PostMapping("/addGroupJoin")
    @ApiOperation(value = "添加参与活动")
    public R addGroupJoin(@RequestBody GroupJoin groupJoin){
        return groupJoinService.addGroupJoin(groupJoin);
    }
    @PostMapping("/updateGroupJoin")
    @ApiOperation(value = "修改参与活动")
    public R updateGroupJoin(@RequestBody GroupJoin groupJoin){
        return groupJoinService.updateGroupJoin(groupJoin);
    }
    @PostMapping("/deleteGroupJoin")
    @ApiOperation(value = "删除参与活动")
    public R deleteGroupJoin(@RequestBody GroupJoin groupJoin){
        return groupJoinService.deleteGroupJoin(groupJoin);
    }
    @PostMapping("/deleteAllGroupJoin")
    @ApiOperation(value = "批量删除参与活动")
    public R deleteAllGroupJoin(@RequestBody List<GroupJoin> groupJoinList){
        return groupJoinService.deleteAllGroupJoin(groupJoinList);
    }

    @PostMapping("/getGroupList")
    @ApiOperation(value = "参团列表")
    public R getGroupList(@RequestBody GroupVo groupVo){
        return groupService.getGroupList(groupVo);
    }

    @PostMapping("/getMyOrderList")
    @ApiOperation(value = "查看我的拼团订单")
    public R getOrderListById(){
        return  groupService.getOrderListById();
    }
    @PostMapping("/deleteOrder")
    @ApiOperation(value = "删除订单")
    public R deleteOrder(@RequestBody Order order){
        return  groupService.deleteOrder(order);
    }
}
